package RemoteServer;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;

import DataBase.DB_Factory;
import Po.BookPO;
import Po.IdCustomer;
import Po.Manager;
import Po.ManagerCustomer;
import Po.Message;
import Po.Order;
import Po.Promotion;
import Po.State;
import RemoteServerInterface.SaleManagerServerInterface;

public class SaleManagerServer extends UnicastRemoteObject  implements SaleManagerServerInterface {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public SaleManagerServer() throws RemoteException {}

	@Override
	public ManagerCustomer getCustomer(int customerID) {
		return DB_Factory.getCustomerServerDB().getCustomer(customerID);
	}

	@Override
	public ArrayList<IdCustomer> getAllCustomer() {
		return DB_Factory.getCustomerServerDB().getAllCustomer();
	}

	@Override
	public BookPO getBookDetail(String ISBN) {
		return DB_Factory.getBookServerDB().getBookDetail(ISBN);
	}

	@Override
	public Message addBook(BookPO book) {
		return DB_Factory.getBookServerDB().addBook(book);
	}

	@Override
	public Message deleteBook(String ISBN) {
		return DB_Factory.getBookServerDB().deleteBook(ISBN);
	}

	@Override
	public Message modifyBook(BookPO book) {
		return DB_Factory.getBookServerDB().modifyBook(book);
	}

	@Override
	public Message addNode(String fatherName, String thisName) {
		return DB_Factory.getBookServerDB().addNode(fatherName, thisName);
	}

	@Override
	public Message deleteNode(String name) {
		return DB_Factory.getBookServerDB().deleteNode(name);
	}

	@Override
	public Message modifyNode(String preName, String newName) {
		return DB_Factory.getBookServerDB().modifyNode(preName, newName);
	}

	@Override
	public Message presentPromotion(Promotion promotion, int ID, int num) {
		return DB_Factory.getPromotionServerDB().presentPromotionById(promotion, ID, num);
	}

	@Override
	public ArrayList<Promotion> getAllPromotionList() {
		return DB_Factory.getPromotionServerDB().getAllPromotionList();
	}

	@Override
	public Message modifyOrder(int orderID, State state) {
		return DB_Factory.getOrderServerDB().modifyOrder(orderID, state);
	}

	@Override
	public ArrayList<Order> getUnfinishedOrderList() {
		return DB_Factory.getOrderServerDB().getUnfinishedOrderList();
	}

	@Override
	public Manager SaleManagerLogin(Manager manager) {
		return DB_Factory.getManagerServerDB().SaleManagerLogin(manager);
	}

}
